Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  What is the output of given program if user e... Start Learning for Free
What is the output of given program if user enter value 99?
#include<stdio.h>
void main()
{
    int i;
    printf("Enter a number:");
    scanf("%d", &i); // 99 is given as input.
    if(i%5 == 0){
        printf("nNumber entered is divisible by 5");
        }
}
  • a)
    Enter a number:99
  • b)
    Enter a number:99 Number is divisible by 5
  • c)
    complier error
  • d)
    Run time error
Correct answer is option 'A'. Can you explain this answer?
Most Upvoted Answer
What is the output of given program if user enter value 99?#include<...
since this program isn't having any syntax error so program is executed. It is clearly seen that 99 is not divisible by 5. So if statement will not execute and program will terminate.
Free Test
Community Answer
What is the output of given program if user enter value 99?#include<...
Program Overview
The provided C program prompts the user to enter a number and checks if that number is divisible by 5. The main parts of the code include:
- Variable Declaration: An integer variable `i` is declared.
- Input Prompt: The user is asked to enter a number.
- Input Capture: The program captures the input using `scanf`.
- Divisibility Check: The program checks if the number is divisible by 5.
Input Analysis
When the user enters the value 99, the following occurs:
- The program prints: "Enter a number:"
- The input `99` is stored in the variable `i`.
Condition Evaluation
The critical part of the program is the `if` statement:
- Condition: `if(i % 5 == 0)`
- For `i = 99`, the calculation becomes `99 % 5`, which equals 4 (not divisible by 5).
Program Output
Since the condition evaluates to false, the code inside the `if` block does not execute. Therefore, there is no additional output related to divisibility.
Final Output
The only output from the program when the user enters 99 is:
- "Enter a number:99"
This leads us to conclude that the correct answer is option A: Enter a number:99.
Summary
- The program correctly prompts for input.
- Since 99 is not divisible by 5, no further message is printed.
- Hence, option A accurately reflects the output.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

What is the output of given program if user enter value 99?#include<stdio.h>void main(){ int i; printf("Enter a number:"); scanf("%d", &i); // 99 is given as input. if(i%5 == 0){ printf("nNumber entered is divisible by 5"); }}a)Enter a number:99b)Enter a number:99 Number is divisible by 5c)complier errord)Run time errorCorrect answer is option 'A'. Can you explain this answer?
Question Description
What is the output of given program if user enter value 99?#include<stdio.h>void main(){ int i; printf("Enter a number:"); scanf("%d", &i); // 99 is given as input. if(i%5 == 0){ printf("nNumber entered is divisible by 5"); }}a)Enter a number:99b)Enter a number:99 Number is divisible by 5c)complier errord)Run time errorCorrect answer is option 'A'. Can you explain this answer? for Computer Science Engineering (CSE) 2025 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about What is the output of given program if user enter value 99?#include<stdio.h>void main(){ int i; printf("Enter a number:"); scanf("%d", &i); // 99 is given as input. if(i%5 == 0){ printf("nNumber entered is divisible by 5"); }}a)Enter a number:99b)Enter a number:99 Number is divisible by 5c)complier errord)Run time errorCorrect answer is option 'A'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for What is the output of given program if user enter value 99?#include<stdio.h>void main(){ int i; printf("Enter a number:"); scanf("%d", &i); // 99 is given as input. if(i%5 == 0){ printf("nNumber entered is divisible by 5"); }}a)Enter a number:99b)Enter a number:99 Number is divisible by 5c)complier errord)Run time errorCorrect answer is option 'A'. Can you explain this answer?.
Solutions for What is the output of given program if user enter value 99?#include<stdio.h>void main(){ int i; printf("Enter a number:"); scanf("%d", &i); // 99 is given as input. if(i%5 == 0){ printf("nNumber entered is divisible by 5"); }}a)Enter a number:99b)Enter a number:99 Number is divisible by 5c)complier errord)Run time errorCorrect answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of What is the output of given program if user enter value 99?#include<stdio.h>void main(){ int i; printf("Enter a number:"); scanf("%d", &i); // 99 is given as input. if(i%5 == 0){ printf("nNumber entered is divisible by 5"); }}a)Enter a number:99b)Enter a number:99 Number is divisible by 5c)complier errord)Run time errorCorrect answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of What is the output of given program if user enter value 99?#include<stdio.h>void main(){ int i; printf("Enter a number:"); scanf("%d", &i); // 99 is given as input. if(i%5 == 0){ printf("nNumber entered is divisible by 5"); }}a)Enter a number:99b)Enter a number:99 Number is divisible by 5c)complier errord)Run time errorCorrect answer is option 'A'. Can you explain this answer?, a detailed solution for What is the output of given program if user enter value 99?#include<stdio.h>void main(){ int i; printf("Enter a number:"); scanf("%d", &i); // 99 is given as input. if(i%5 == 0){ printf("nNumber entered is divisible by 5"); }}a)Enter a number:99b)Enter a number:99 Number is divisible by 5c)complier errord)Run time errorCorrect answer is option 'A'. Can you explain this answer? has been provided alongside types of What is the output of given program if user enter value 99?#include<stdio.h>void main(){ int i; printf("Enter a number:"); scanf("%d", &i); // 99 is given as input. if(i%5 == 0){ printf("nNumber entered is divisible by 5"); }}a)Enter a number:99b)Enter a number:99 Number is divisible by 5c)complier errord)Run time errorCorrect answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice What is the output of given program if user enter value 99?#include<stdio.h>void main(){ int i; printf("Enter a number:"); scanf("%d", &i); // 99 is given as input. if(i%5 == 0){ printf("nNumber entered is divisible by 5"); }}a)Enter a number:99b)Enter a number:99 Number is divisible by 5c)complier errord)Run time errorCorrect answer is option 'A'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev